<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@page import="java.net.URLDecoder"%>
<%@ page import="com.sz.common.SZUtility" %>
<%@ page import="com.sz.announce.dao.IAnnounceDAO" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="com.sz.common.SZUtility" %>


<%

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";


String style1 = "width: 100px;text-align:right;font-size: 12px;";
String style2 = "width: 220px";
String input_text_gray = "width: 220px; color: gray";




ServletContext servletContext = request.getSession().getServletContext(); 
ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
IAnnounceDAO dao = (IAnnounceDAO) context.getBean("AnnounceDAO");

String show_title = request.getParameter("show_title");
if(show_title == null || show_title.length() == 0) show_title = "1"; //默认显示

String show_confirm_title = request.getParameter("show_confirm_title"); //是否显示"确认信息"四个字
if(show_confirm_title == null || show_confirm_title.length() == 0) show_confirm_title = "1"; //默认显示

Map<Object, Object> param = new HashMap<Object, Object>();
String announce_seating_id = request.getParameter("ANNOUNCE_SEATING_ID");
param.put("ANNOUNCE_SEATING_ID", announce_seating_id);
List list = dao.queryAnnounce_seating(param);
Map map = new HashMap();
if(list.size() > 0) {
	map = (Map)list.get(0);
}


String ann_title = SZUtility.toString(map.get("TITLE"));
String ann_content = SZUtility.toString(map.get("CONTENT"));
String ann_begin_time = SZUtility.toString(map.get("BEGIN_TIME")).substring(0,10);
String ann_end_time = SZUtility.toString(map.get("END_TIME")).substring(0,10);
//String ann_state = SZUtility.toString(map.get("STATE"));

%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link href="<%= request.getContextPath() %>/css/main.css" rel="stylesheet" type="text/css" />
		<base href="<%=basePath%>" target="_self">
		<title>修改坐席公告</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="">
		<meta http-equiv="description" content="" >
	</head>
	
	<body>
		<script type="text/javascript" src="js/jquery.js"></script>
		<script type="text/javascript" src="js/calendar.js"></script>
		<script type="text/javascript" src="js/utility.js"></script>
		
		<table width="100%">
		  <tr>
		  	<td colspan="3" class="title0" >修改坐席公告</td>		  	
	  	  </tr>
	  	</table> 

	  	
	  	
	  	

	  	<table id = "announce_seating" width="100%" border="0" cellpadding="0" cellspacing="0" style="line-height:30px;">
	  		<tr>
	  			<th colspan="4" align="left">&nbsp;&nbsp;&nbsp;公告信息</th>
	  		</tr>
	  		<tr>
	  			<td style="<%=style1%>">公告标题&nbsp;&nbsp;&nbsp;</td>
	  			<td>
	  				<input type="text" id="ann_title" name="ann_title" value="<%=ann_title%>" style="<%=style2%>" >	  			
	  			</td>
	  			
	  			<td style="<%=style1%>">公告状态&nbsp;&nbsp;&nbsp;</td>
	  			<td >
	  			     <select id="state" name="state" style="<%=style2%>">
									<option value="1">有效</option>
					    			<option value="0">无效</option>
			  	      </select>
	  			</td>	  			
	  		</tr>
	  		
	  		<tr>
	  			<td style="<%=style1%>">公告内容&nbsp;&nbsp;&nbsp;</td>
	  			<td colspan="3">
	  				<textarea id="ann_content" name="ann_content" style="width:300px; height:100px" ><%=ann_content%></textarea>	  			
	  			</td>
	  		</tr>
	  		
	  		<tr>
	  			<td style="<%=style1%>">开始时间&nbsp;&nbsp;&nbsp;</td>
	  			<td>
	  				<input type="text" id="ann_begin_time" name="ann_begin_time" value="<%=ann_begin_time%>" style="<%=style2%>" readonly="readonly" onclick="calendar.show(this)" >	  			
	  			</td>
	  			
	  			<td style="<%=style1%>">结束时间&nbsp;&nbsp;&nbsp;</td>
	  			<td>
	  				<input type="text" id="ann_end_time" name="ann_end_time" value="<%=ann_end_time%>" style="<%=style2%>" readonly="readonly" onclick="calendar.show(this)" >	  			
	  			</td>	  			
	  		</tr>
	  	</table>

	  	<input type = "hidden" id="ann_state" name = "ann_state" >
	  	

	  	
	  	<table width="100%" border="0" cellpadding="0" cellspacing="0" >
	  		<tr align="center">
	  			<td><input type="submit" value="提交" onclick="onSubmit()"/></td>
	  		</tr>
		</table>
		
		<form name="upt_announce_seating"  action="announce/uptAnnounceSeating.exec" method="post" style="display: none;">
    		<input id="ANNOUNCE_TYPE" name="ANNOUNCE_TYPE" value="SEATING" />
  			<input id="OPERATE_TYPE " name="OPERATE_TYPE" value="UPT" />
  			<input id="PARAM" name="PARAM" value="" />
	  	</form>
	

		
	<SCRIPT LANGUAGE="JavaScript">	

	  		function onSubmit() {
	  			var param = "{ANNOUNCE_SEATING_ID:";
  				param += "'"+"<%=announce_seating_id%>"+"',";
  				param += "TITLE:'";
  				param += document.getElementById("ann_title").value + "',";
			  	param += "CONTENT:'";
  				param += document.getElementById("ann_content").value + "',";
  				param += "STATE:'";
  				param += document.getElementById("state").value + "',";
  				param += "BEGIN_TIME:'";
  				param += document.getElementById("ann_begin_time").value + "',";
  				param += "END_TIME:'";
  				param += document.getElementById("ann_end_time").value + "'";
  				param += "}";


  				document.getElementById("PARAM").value = param;

  				document.getElementById("upt_announce_seating").submit();

  		  		window.close();	
  	  		} 
  		
		function onClickRadio_state(value) {
  			if(value == '0') {
 				document.getElementById("ann_state_0").checked = true;
 				document.getElementById("ann_state_1").checked = false;
 			} else {
 				document.getElementById("ann_state_1").checked = true;
 				document.getElementById("ann_state_0").checked = false; 				
 			} 
  		}
  		
  		function check() {
  		
  			var tmp;
			
  			tmp = document.getElementById("ann_title").value;
  			tmp = jQuery.trim(tmp);
  			if(tmp == "") {
  	  			alert("请输入公告标题");
  	  			return false;
  			}
  			
  			tmp = document.getElementById("ann_begin_time").value;
  			tmp = jQuery.trim(tmp);
  			if(tmp == "") {
  	  			alert("请选择开始时间");
  	  			return false;
  			}
  			
  			tmp = document.getElementById("ann_end_time").value;
  			tmp = jQuery.trim(tmp);
  			if(tmp == "") {
  	  			alert("请选择结束时间");
  	  			return false;
  			}
  			
  			//状态
  			tmp = "-1";
  			if(document.getElementById("ann_state_1").checked == true) {
  				tmp = "1";
  			} else if (document.getElementById("ann_state_0").checked == true) {
  				tmp = "0";
  			} else { //应该不会出现这种情况
  				alert("请选择公告状态");
  	  			return false;
  			}
  			document.getElementById("ann_state").value = tmp;
  			
  			return true;
  			
  		}
	</SCRIPT>
	</body>
</html>
